<?php
	require_once '../../controller/selecao/' . basename(__FILE__);
	require_once '../../model/Perfil.class.php';
	$pagina[0] = array('Processo de Seleção', '../../view/selecao/pesquisar.php');
	$pagina[1] = array('Acompanhamento da Seleção', '../../view/selecao/candidatoSelecao.php?selecaoid=' . $_GET['id'] );
	$pagina[2] = array('Adicionar Candidato');
    require_once '../../template/header.php';
?>
<ul class="navmenu">
	<li><a class="voltar" href="selecao.php?id=<?php echo $_GET['id'] ?>">Voltar</a></li>
</ul>
<div id="conteudo">
     <form method="post" action="<?php echo basename(__FILE__);?>?id=<?php echo $_GET['id'] ?>" >
     	
     	<?php TMensagens::exibirStatus( $erro, $sucesso ) ?>
     	
     	<?php include( 'helper_detalhesVaga.php' ); ?>
		
		<fieldset>
        	<legend>Candidato</legend>
        	<table>
        		<tr>
                    <td>CPF</td>
                    <td>
                    	<input type="text" name="txtCpf" id="txtCpf" class="textoPequeno maskCpf" value="<?php echo $candidato->cpf ?>" <?php if ( isset($_POST['txtCpf']) AND $erro == NULL ) { echo 'disabled="disabled"'; } ?> />&nbsp;
                    	<?php if ( !isset( $_POST['btnAcao'] ) OR !isset( $_POST['txtCpf'] ) OR $erro ): ?>
                    	<button type="submit" name="btnAcao" value="Pesquisar" class="detalhes" title="Pesquisar">Consultar</button>
                    	<?php else: ?>
                		&nbsp;<a href="<?php echo basename(__FILE__); ?>?id=<?php echo $_GET['id'] ?>">Pesquisar Outro Candidato</a>
                        <?php endif; ?>
                    </td>
                </tr>
                <?php if ( isset( $_POST['btnAcao'] ) AND isset( $_POST['txtCpf'] ) AND $erro == NULL ): ?>
                
                <tr>
                    <td>Nome</td>
                    <td>
                    	<input type="text" name="txtNome" id="txtNome" class="textoGrande" value="<?php echo $candidato->nome ?>" <?php echo $disabledCampos ?> />
                    	<input type="hidden" name="nome" value="<?php echo $candidato->nome ?>"/>
                    	<input type="hidden" name="cpf" value="<?php echo $candidato->cpf ?>"/>
                    </td>
                </tr>
                <tr>
                    <td>Telefone</td>
                    <td><input type="text" name="txtContato" id="txtContato" class="textoPequeno maskFone" value="<?php echo $candidato->contato ?>"/></td>
                </tr>
                <tr>
                    <td>Telefone 2</td>
                    <td><input type="text" name="txtTelefone2" id="txtTelefone2" class="textoPequeno maskFone opcional" value="<?php echo $candidato->telefone2 ?>"/></td>
                </tr>
                
                <?php endif; ?>
            </table>
		</fieldset>
		
		<?php if ( isset( $_POST['btnAcao'] ) AND isset( $_POST['txtCpf'] ) AND $erro == NULL ): ?>
		<p class="botoeira">
			<button type="submit" name="btnAcao" value="Salvar">Adicionar Candidato</button>
		</p>
		<?php endif; ?>
		
    </form>
</div>
<?php require_once '../../template/footer.php'; ?>